//防止读写超界的缓冲区数组
#ifndef RTSP_SERVICE_PBUFARRY_H
#define RTSP_SERVICE_PBUFARRY_H

#define PBUFARRAY_RTE_ERRAR     -1
#define PBUFARRAY_RET_SUCCEED   0

typedef struct PBufArray {
    unsigned int r_idx;                               //读取位置
    unsigned int w_idx;                               //写入位置
    unsigned int buf_len;                             //缓冲区长度
    unsigned char *buf;                               //缓冲区
} PBufArray;

extern void PBufArray_init(PBufArray *buf, unsigned char *array, unsigned int array_len);
extern int PBufArray_wirite_byte(PBufArray *buf, unsigned char ch);
extern int PBufArray_read_byte(PBufArray *buf, unsigned char *ch);
extern int PBufArray_reset(PBufArray *buf);
extern int PBufArray_read_back(PBufArray *buf);
int PBufArray_wirte_back(PBufArray *buf);

#endif //RTSP_SERVICE_PBUFARRY_H
